<script setup>
import { onActivated, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { useUserStore } from '@/store'
import Wallet from '@/components/wallet/index.vue'
import BiSignin from '@/components/biSignin/index.vue'

import Lottery from './components/lottery.vue'
import NewbieTask from './components/newbieTask.vue'
import EpisodeTask from './components/episodeTask.vue'

import { TaskCenterInsert } from '/public/adConfig.js'
import { usePageSlotAd } from '@/utils/adx.js'

const userStore = useUserStore()
const route = useRoute()
if (route.query.device) {
    userStore.$patch({
        uuid: route.query.device
    })
}
userStore.handleGetUserInfo()

onActivated(() => {
    // usePageSlotAd(TaskCenterInsert)
});

onMounted(() => {
    window['handleGetUserInfo'] = () => {
        userStore.handleGetUserInfo()
    }
})
</script>

<template>
    <div class="task">
        <Wallet />
        <div class="task-bottom">

            <BiSignin />

            <Lottery />

            <NewbieTask v-if="!userStore.finishNewbieTask && !userStore.receiveReward" />

            <EpisodeTask />

        </div>
    </div>
</template>

<style scoped lang="scss">
@import url(./task.scss);
</style>